﻿using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web; 

namespace App.Components
{
    /// <summary>
    /// ASP.NET 网页相关辅助方法
    /// </summary>
    public class Asp
    {
         
        /// <summary>获取上下文数据（在每次请求中有效）</summary>
        public static object GetContextData(string key, Func<object> creator = null)
        {
            if (creator != null && !GlobalVar.Current.Items.Where(x => x.Key.ToString() == key).Any())
                GlobalVar.Current.Items[key] = creator();
            return GlobalVar.Current.Items[key];
        }


    }
}